
//Copyright 1997-2009 Syrinx Development, Inc.
//This file is part of the Syrinx Web Application Framework (SWAF).
// == BEGIN LICENSE ==
//
// Licensed under the terms of any of the following licenses at your
// choice:
//
//  - GNU General Public License Version 3 or later (the "GPL")
//    http://www.gnu.org/licenses/gpl.html
//
//  - GNU Lesser General Public License Version 3 or later (the "LGPL")
//    http://www.gnu.org/licenses/lgpl.html
//
//  - Mozilla Public License Version 1.1 or later (the "MPL")
//    http://www.mozilla.org/MPL/MPL-1.1.html
//
// == END LICENSE ==
using System;
using System.Collections;

namespace Swaf.BizObj
{
	public enum BizFieldType
	{
		NetClass, BizObj, BizObjList, Method
	}

	/// <summary>
	/// Summary description for IBizObjDefinition.
	/// </summary>
	public interface IBizObjDefinition
	{
		string Name{get;}
		IBizObjDefinition Parent{get;}
		IList KeyFields{get;}
		string KeyFieldNames {get;}
		IDictionary Fields{get;}
		IList FieldList{get;}
		IList OrderedFields{get;}
		IBizObjField getField(string name, bool caseSensitive);

		/// <summary>
		/// Given a string this method will get the type of the key for this bizobj and attempt to convert
		/// the string into that type.
		/// </summary>
		/// <param name="val">The key value to be converted</param>
		/// <returns>The val passed converted into the type of the key which must also implement IComparable.</returns>
		IComparable convertValueToKeyType(string val);

		bool isKindOf(string bizObjType);
	}

	public interface IBizObjDefinitionEx
	{
		IBizObjField addField(string name, BizFieldType BizFieldType, object newValue, bool cloneOnCreate, IList validators, string actualFieldType);
		IBizObjField decorateField(string name);
	}

	public interface IBizObjDefinitionEx2 : IBizObjDefinition
	{
		IBizObjField addField(string name, BizFieldType BizFieldType, object newValue, string actualFieldType);
		IBizObjField decorateField(string name);
		void removeField(string name);
	}
}
